{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "colab_type": "text",
        "id": "JndnmDMp66FL"
      },
      "source": [
        "#### Copyright 2017 Google LLC."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 0,
      "metadata": {
        "cellView": "both",
        "colab": {},
        "colab_type": "code",
        "id": "hMqWDc_m6rUC"
      },
      "outputs": [],
      "source": [
        "# Licensed under the Apache License, Version 2.0 (the \"License\");\n",
        "# you may not use this file except in compliance with the License.\n",
        "# You may obtain a copy of the License at\n",
        "#\n",
        "# https://www.apache.org/licenses/LICENSE-2.0\n",
        "#\n",
        "# Unless required by applicable law or agreed to in writing, software\n",
        "# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
        "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
        "# See the License for the specific language governing permissions and\n",
        "# limitations under the License."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "colab_type": "text",
        "id": "cH-YtyZs7Gcg"
      },
      "source": [
        "# Prework: Hello World"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "colab_type": "text",
        "id": "r0QBC2kTixPn"
      },
      "source": [
        "**Learning Objective:** Run a TensorFlow program in the browser."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "colab_type": "text",
        "id": "33fL46pgixPo"
      },
      "source": [
        "The code block below is a \"Hello World\" TensorFlow program.\n",
        "\n",
        "It consists of initialization code (importing tensorflow module and enabling \"eager execution\", which will be covered in more detail in subsequent exercises) and printing a \"Hello, world!\" string constant."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 0,
      "metadata": {
        "cellView": "both",
        "colab": {},
        "colab_type": "code",
        "id": "bRuPN7qo7ICp"
      },
      "outputs": [],
      "source": [
        "from __future__ import print_function\n",
        "\n",
        "import tensorflow as tf\n",
        "try:\n",
        "  tf.contrib.eager.enable_eager_execution()\n",
        "except ValueError:\n",
        "  pass  # enable_eager_execution errors after its first call\n",
        "\n",
        "tensor = tf.constant('Hello, world!')\n",
        "tensor_value = tensor.numpy()\n",
        "print(tensor_value)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "colab_type": "text",
        "id": "Bl1nAshab6m5"
      },
      "source": [
        "## To Run This Program\n",
        "\n",
        "  1. Click anywhere in the code block (for example, on the word `import`).\n",
        "\n",
        "  2. Click the right-facing-triangle icon in the upper-left corner of the code block, or hit ⌘/Ctrl-Enter.\n",
        "\n",
        "     The program will take a few seconds to run. If all goes well, the program will write the phrase `Hello, world!` just below the code block\n",
        "\n",
        "This entire program consists of a single code block. However, most exercises consist of multiple code blocks, in which case you should **run the code blocks individually in sequence, from top to bottom.** \n",
        "\n",
        "Running the code blocks out of sequence typically causes errors."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "colab_type": "text",
        "id": "UpzZ0Gv-uKf_"
      },
      "source": [
        "## Useful Keyboard Shortcuts\n",
        "\n",
        "* **⌘/Ctrl+m** then **b**: creates an empty code cell below the cell that's currently selected\n",
        "* **⌘/Ctrl+m** then **i**: interrupts a running cell\n",
        "* **⌘/Ctrl+m** then **h**: shows a list of all keyboard shortcuts\n",
        "* For documentation on any TensorFlow API method, place the cursor right after its opening parenthesis and hit **Tab**:\n",
        "\n",
        "  ![pop-up documentation for TensorFlow tf.constant method](https://download.mlcc.google.com/mledu-images/tf_pop_up_doc_example.png)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 0,
      "metadata": {
        "colab": {},
        "colab_type": "code",
        "id": "5Ojo7xzOy8pN"
      },
      "outputs": [],
      "source": [
        ""
      ]
    }
  ],
  "metadata": {
    "colab": {
      "collapsed_sections": [
        "JndnmDMp66FL"
      ],
      "name": "hello_world.ipynb",
      "provenance": [],
      "version": "0.3.2"
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}
